<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/default/easyui.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/icon.css"></link>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/demo/demo.css"></link>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.min.js"></script>
	<script language="JavaScript"  type="text/javascript" src="js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
	<script type="text/javascript">
	 /*<![CDATA[*/ 
	            
	 var gareaid;
	 var gw;
	 var gh;
	$(document).ready(  
			  function(){
				 showAreaList();
				 $('#tt').tabs({
						onSelect: function(title,index){
							refresh();
					  }
					});
				 
				 gh=$(document).height();
			     gw=$(document).width();
			     
	 });
	 
	 var area;
	
	function showAreaList()
	{
		$.get("areaList", function(data){
			
				area = data;
			 	var i;
			 	for(i=0;i<data.length;i++)
			 		{
			 			var item = data[i];
			 			
			 			var url="show_deskdetail?areaid="+item.id;
			 			
			 			addPanel(item.areaname,url,1);
			 			
			 		}
			 
			});
	}
 	
	
	function addPanel(text,url,flag){
	    var is = $('#tt').tabs("exists",text);
	    
	    var html ='<iframe name="sframe" frameborder="no" src="'+url+'" width="100%" height="400px"></iframe>';
	    
	    
	    if(is==true)
	    	 var is = $('#tt').tabs("close",text);
	    if(flag==1)
	    {
	    	$("#tt").tabs("add",{
				title: text,
				tabWidth:150,
				content: html,
				closable: false
			});	
	    }else
	    {
	    	$("#tt").tabs("add",{
				title: text,
				content: html,
				closable: true
			});
	    }
	    
	    $("[name=sframe]").height(self.parent.gheight-100); 
	    //$("[name=sframe]").width(1206); 
	    $("#tt").width(1206); 
		
	}
	
	function refresh()
	{
		
		var text = $('#tt').tabs('getSelected').panel('options');
	    var ttitle=text.title;
		var surl="";
		for(i=0;i<area.length;i++)
 		{
 			var item = area[i];
 			if(item.areaname==ttitle)
 			{
 				gareaid= item.id;
 				break;
 			}
 		}
		
		return;
		
	}
	
	
	/*]]>*/  
	</script>
</head>
<body>
	<div id="tt" class="easyui-tabs"  data-options="pill:true" style="position:absolute;left:0px;top:0px">
	</div>

</body>
</html>